<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>问题显示 - 基于SpringBoot的社区问答系统</title>
    <base target="_blank">
    <!-- layui -->
    <link th:href="@{lib/layui/css/layui.css}" rel="stylesheet">
    <script th:src="@{lib/layui/layui.js}"></script>
    <!-- marked -->
    <script th:src="@{lib/marked/marked.min.js}"></script>
    <!-- marked-gfm-heading-id -->
    <script th:src="@{lib/marked/marked-gfm-heading-id.umd.js}"></script>
    <script>marked.use(markedGfmHeadingId.gfmHeadingId());</script>
    <!-- highlight.js -->
    <script th:src="@{lib/highlight.js/highlight.min.js}"></script>
    <!-- highlight.js vscode theme -->
    <link th:href="@{css/xkk1-highlightjs-vscode-theme.css}" rel="stylesheet">
    <!-- vditor -->
<!--    <link th:href="@{lib/vditor/index.css}" rel="stylesheet">-->
<!--    <script th:src="@{lib/vditor/index.min.js}"></script>-->
    <!-- 工具函数 -->
    <script th:src="@{js/utilities.js}"></script>
    <link th:href="@{css/question-answer.css}" rel="stylesheet">
    <script th:src="@{js/question-answer.js}"></script>
</head>
<body>
    <main id="main">
        <h1 id="title">正在加载问题 . . .</h1>
        <div id="content" class="layui-text"></div>
        <div id="question-info">
            <span id="question-author"></span>
            <span id="question-time"></span>
        </div>
        <div id="answer-div">
            <button id="answer-add" class="layui-btn layui-btn-primary layui-btn-sm">新增回答</button>
            <div style="float: right">
                <button id="answer-edit" class="layui-btn layui-btn-primary layui-btn-sm">编辑问题</button>
                <button id="answer-delete" class="layui-btn layui-btn-primary layui-btn-sm">删除问题</button>
            </div>
            <div id="answer-list">
                <p>正在加载回答 . . .</p>
            </div>
        </div>
    </main>

<script id="answer-template" type="text/html">
    <div class="layui-timeline">
        {{#  layui.each(d, function(index, item){ }}
        <div class="layui-timeline-item">
            <i class="layui-icon layui-timeline-axis layui-icon-username" onclick="showOption({{= index }})"></i>
            <div class="layui-timeline-content layui-text">
                <h3 class="layui-timeline-title">
                    <span class="answer-username">{{= getUsernameById(item.userId) }}</span>
                    <span class="answer-time">{{= item.createdAt.replace('T', ' ') }}</span>
                </h3>
                {{- marked.parse(item.content) }}
            </div>
        </div>
        {{#  }); }}
        {{#  if(d.length === 0){ }}
        <p>
            暂无评论
        </p>
        {{#  } }}
    </div>
</script>

</body>
</html>